package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInInvoice61;
import com.ims.core.doc.service.ITInInvoice61Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 61 数电发票（航空运输电子客票行程单） Controller
 *
 * @author IMS
 * @date 2024-11-26
 */
@RestController
@RequestMapping("/doc/hangkongdianzi")
public class TInInvoice61Controller extends BaseController
{
    @Autowired
    private ITInInvoice61Service tInInvoice61Service;

    /**
     * 查询61 数电发票（航空运输电子客票行程单） 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInInvoice61 tInInvoice61)
    {
        startPage();
        List<TInInvoice61> list = tInInvoice61Service.selectTInInvoice61List(tInInvoice61);
        return getDataTable(list);
    }

    /**
     * 导出61 数电发票（航空运输电子客票行程单） 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:export')")
    @Log(title = "61 数电发票（航空运输电子客票行程单） ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInInvoice61 tInInvoice61)
    {
        List<TInInvoice61> list = tInInvoice61Service.selectTInInvoice61List(tInInvoice61);
        ExcelUtil<TInInvoice61> util = new ExcelUtil<TInInvoice61>(TInInvoice61.class);
        util.exportExcel(response, list, "61 数电发票（航空运输电子客票行程单） 数据");
    }

    /**
     * 获取61 数电发票（航空运输电子客票行程单） 详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInInvoice61Service.selectTInInvoice61ById(id));
    }

    /**
     * 新增61 数电发票（航空运输电子客票行程单） 
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:add')")
    @Log(title = "61 数电发票（航空运输电子客票行程单） ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInInvoice61 tInInvoice61)
    {
        return toAjax(tInInvoice61Service.insertTInInvoice61(tInInvoice61));
    }

    /**
     * 修改61 数电发票（航空运输电子客票行程单） 
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:edit')")
    @Log(title = "61 数电发票（航空运输电子客票行程单） ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInInvoice61 tInInvoice61)
    {
        return toAjax(tInInvoice61Service.updateTInInvoice61(tInInvoice61));
    }

    /**
     * 删除61 数电发票（航空运输电子客票行程单） 
     */
    @PreAuthorize("@ss.hasPermi('doc:hangkongdianzi:remove')")
    @Log(title = "61 数电发票（航空运输电子客票行程单） ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInInvoice61Service.deleteTInInvoice61ByIds(ids));
    }
}
